Answer:

' Program to add two numbers
PRINT 1.5 + 4.2
END

If you run this program it prints 5.7 on the computer monitor.

Floating Point Numbers

The numbers that you use with QBasic are the same as those you use with an electronic calculator. You can use numbers that include a decimal fraction such as the two numbers above.

Numbers such as 1.5 or 3.14159 or 123.821 are called floating point numbers because the decimal point "floats" among the digits to get to the correct location. A number without a decimal point, such as 12 or -23 or 194, is called an integer.

QBasic can do anything an electronic calculator can do (and much more). For example, it can multiply numbers. To multiply numbers, use * instead of the usual multiply symbol (which is not on the computer keyboard). The character * is on the same key as "8" on the computer keyboard.

QUESTION 8:

Write a program that MULTIPLIES 12.1 by 2 and prints the result on the monitor. (Write the program on a scrap of paper.)